/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = t__sip_destroy_stmt.c                             */
/*  NOTE      =                                                    */
/*  DATE      = 2016/02/16 by songbb                               */
/*******************************************************************/

#include <CUnit/Basic.h>

#include "frcomm.h"
#include "frmem.h"

#include "../../../src/module/sip/config.h"
#include "../test_sip_comm.h"
#include <sip/sip_comm.h>

extern void __sip_destroy_stmt(Frhash_header *p_hash_stmt);

static int __suite_init(void)
{
    return 0;
}

static int __suite_cleanup(void)
{
    return 0;
}

static void __case1(void)
{

    Frhash_header *p_hash_stmt = NULL;
    p_hash_stmt = (Frhash_header *) frmalloc(sizeof(Frhash_header));
    CU_ASSERT_PTR_NOT_NULL(p_hash_stmt);

    memset(p_hash_stmt, 0x00, sizeof(Frhash_header));
    CU_ASSERT_EQUAL(frhash2_create(p_hash_stmt, APM_SIP_HASH_SIZE), FR_SUCC);

    __sip_destroy_stmt(p_hash_stmt);
}

int add_suite__sip_destroy_stmt(void)
{
    CU_pSuite pSuite = NULL;

    if ((pSuite = CU_add_suite(MODULE_NAME" __sip_destroy_stmt()", __suite_init, __suite_cleanup)) == NULL)
        return FR_FAIL;

    if (CU_add_test(pSuite, "case1", __case1) == NULL)
        return FR_FAIL;

    return FR_SUCC;
}
